package com.factory.iamp.pojo;

import com.factory.iamp.utils.helper.ExcelHelper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.File;
import java.sql.Timestamp;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TableTemplateTail {
    private int oid;
    private int lid;
    private String name;
    private String format;
    private String file_path;
    private String json;
    private String defaultValue;
    private Timestamp created_at;

    public void insertBuild(
            String name, File savedFile, String fileName, String file_path, String json, String defaultValue, int lid
    ) throws Throwable {
        this.name = name;
        this.lid = lid;
        this.format = ExcelHelper.makeFormat(savedFile, fileName);
        this.file_path = file_path;
        this.created_at = new Timestamp(System.currentTimeMillis());
        this.json = json;
        this.defaultValue = defaultValue;
    }
}
